package 代码记录.指定公司代码练习记录.西安.分值100分;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

/**
 * @author zx
 * @create 2023-07-03 21:08
 * 人家好的思路
 */
public class 找最小数 {//16---copy
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int n = sc.nextInt();
        Deque<Character> stack = new ArrayDeque<>();
        for(int i = 0;i < str.length();i++){
            while(n > 0 && !stack.isEmpty() && stack.peek() > str.charAt(i)){
                stack.pop();
                n--;
            }
            stack.push(str.charAt(i));
        }
        String res = "";
        for(Character i : stack){
            res += i;
        }
        System.out.println(res);
    }
}
